package com.gui.mianshiya.config;

import com.volcengine.ark.runtime.service.ArkService;
import lombok.Data;
import okhttp3.ConnectionPool;
import okhttp3.Dispatcher;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @Title: aiConfig
 * @Author quit
 * @Package com.gui.mianshiya.config
 * @Date 2025/5/17 13:25
 * @description:
 */
@Configuration
@ConfigurationProperties(prefix = "ais")
@Data
public class aiConfig {
    private String apiKey;

    @Bean
   public ArkService arkService(){
    ConnectionPool pool = new ConnectionPool(5,1, TimeUnit.SECONDS);
        Dispatcher dispatcher = new Dispatcher();
        ArkService build = ArkService.builder().dispatcher(dispatcher).connectionPool(pool).baseUrl("https://ark.cn-beijing.volces.com/api/v3/chat/completions").apiKey(apiKey).build();
        return build;
    }
}
